<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
    <style>
        .show{
            display: block;
        }
        .hide{
            display: none;
        }
        .active{
            background: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <button @click="changeTab(1)" :class="{active:num==1}">按钮一</button>
        <button @click="changeTab(2)" :class="{active:num==2}">按钮二</button>
        <button @click="changeTab(3)" :class="{active:num==3}">按钮三</button>
        <div :class="num==1?'show':'hide'">div111111</div>
        <div :class="num==2?'show':'hide'">div22222</div>
        <div :class="num==3?'show':'hide'">div33333</div>
    </div>
    <script>
        new Vue({
            el:"#app",
            data:{
                num:1
            },
            methods:{
                changeTab(num){
                    // console.log(num);
                    this.num = num;
                }
            }
        })

    </script>
</body>
</html>